<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件捕获</title>
    <style>
        #parent{
            width: 200px;
            height: 200px;
            background-color: cadetblue;
        }
        #child{
            width:100px;
            height: 100px;
            background-color: antiquewhite;    
        }
    </style>
</head>
<body>
    <div id="parent">
        <div id="child">

        </div>
    </div>
    <script>
        var parent = document.getElementById("parent");
        var child = document.getElementById("child");
        parent.addEventListener("click",function(){
            console.log(parent);
        },true) 
        child.addEventListener("click",function(){
            console.log(child);
        },true) 
    </script>
</body>
</html>